<style lang="less">
  .short-task{
    .border-card {
      margin-top: 20px;
    }

    .f-mt10 {
      margin-top: 10px;
    }
    .toolbar {
      .el-date-editor{
        width: 100%;
      }
    }
  }
  .dialog-form-label{
    label{
      width: 120px;
    }

  }
  .dialog-form-content{
    width: 350px
  }
</style>
<template>
  <section class="short-task">
    <!-- 上部开始************-->
    <el-col :span="24" class="toolbar">
      <el-form>
        <el-col :span="23">
          <el-row :data="conditions" style="margin-top: 10px">
            <el-col :span="6">
              <el-form-item label="车牌号" :label-width="searchConditionLabelWidth">
                <el-input
                          v-model="conditions.plateNumber" placeholder="请输入车牌号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="司机" :label-width="searchConditionLabelWidth">
                <el-input
                          v-model="conditions.driverName" placeholder="请输入司机名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="司机手机号" :label-width="searchConditionLabelWidth">
                <el-input
                          v-model="conditions.driverPhone" placeholder="请输入司机手机号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="3">
              <el-form-item label="" label-width="40px">
                <el-checkbox v-model="conditions.isInExecution">
                  有接货任务
                </el-checkbox>
              </el-form-item>
            </el-col>
            <el-col :span="3">
              <el-form-item label="" label-width="40px">
                <el-checkbox v-model="conditions.isSelfDriver">
                  自有司机
                </el-checkbox>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :data="conditions">
            <el-col :span="6">
              <el-form-item label="订单号" :label-width="searchConditionLabelWidth">
                <el-input  v-model="conditions.orderNumber" :disabled="topConditionsDisabled"
                          placeholder="请输入订单号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="提货日期" :label-width="searchConditionLabelWidth">
                <el-date-picker
                  :disabled="topConditionsDisabled"
                  v-model="assignDate"
                  type="daterange"
                  align="right"
                  placeholder="选择日期范围"
                  :picker-options="pickerOptions2">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="发运日期" :label-width="searchConditionLabelWidth">
                <el-date-picker
                  :disabled="topConditionsDisabled"
                  v-model="shipmentsDate"
                  type="daterange"
                  align="right"
                  placeholder="选择日期范围"
                  :picker-options="pickerOptions2">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="3">
              <el-form-item label="" label-width="40px">
                <el-checkbox v-model="conditions.isTemporary">
                  临时车辆/司机
                </el-checkbox>
              </el-form-item>
            </el-col>
            <el-col :span="3">
              <el-form-item label="" label-width="40px">
                <el-checkbox v-model="conditions.isSelfVehicle">
                  自有车辆
                </el-checkbox>
              </el-form-item>
            </el-col>
          </el-row>
        </el-col>
      </el-form>
    </el-col>
    <!-- 操作 -->
    <el-col :span="24" style="margin-bottom: 10px;margin-top: 10px">
      <el-button type="primary" @click="affirmAll" :disabled="topConditionsDisabled">整车确认</el-button>
      <el-button type="primary" @click="resetCondition" style="float: right">重置</el-button>
      <el-button type="primary" @click="handleSearch" style="float: right;margin-right: 10px">查询</el-button>
    </el-col>
    <!--列表-->
    <el-table :data="shortTaskData" highlight-current-row border style="width: 100%;" max-height="200"
              v-loading="listLoading"
              @sort-change="sortChange"
              @selection-change="selsChange"
              @row-click="rowClick">
      <el-table-column type="index" width="60" align="center">
      </el-table-column>
      <el-table-column prop="plateNumber" label="车牌号" width="150" align="center" >
        <template slot-scope="scope">
          <label v-if="scope.row.vehicleProperty === 109013001">{{scope.row.plateNumber}}&nbsp;<label style="background-color: orange;color: white">&nbsp;自有&nbsp;</label></label>
          <label v-if="scope.row.vehicleProperty !== 109013001">{{scope.row.plateNumber}}</label>
        </template>
      </el-table-column>
      <el-table-column prop="driverName" label="司机" width="150" align="center" >
        <template slot-scope="scope">
          <label v-if="scope.row.driverProperty === 109012001">{{scope.row.driverName}}&nbsp;<label style="background-color: orange;color: white">&nbsp;自有&nbsp;</label></label>
          <label v-if="scope.row.driverProperty !== 109012001">{{scope.row.driverName}}</label>
        </template>
      </el-table-column>
      <el-table-column prop="driverPhone" label="联系方式" width="150" align="center" >
      </el-table-column>
      <el-table-column prop="driverInfoId" label="临时车辆/司机" width="140" align="center" :formatter="isTemporary">
      </el-table-column>
      <el-table-column prop="totalVotes" label="票数" width="120" align="center" >
      </el-table-column>
      <el-table-column prop="totalAmount" label="件数" width="150" align="center" >
      </el-table-column>
      <el-table-column prop="totalWeight" label="重量" width="150" align="center" >
        <template slot-scope="scope">
          {{numberFormatter(scope.row.totalWeight)}}
        </template>
      </el-table-column>
      <el-table-column prop="totalVolume" label="体积" width="150" align="center" >
        <template slot-scope="scope">
          {{numberFormatter(scope.row.totalVolume)}}
        </template>
      </el-table-column>
      <el-table-column prop="vehicleLocation" label="当前位置" min-width="150" align="left" header-align="center">
      </el-table-column>
      <el-table-column prop="estimatedTime" label="预计抵达时间" width="200" align="center">
      </el-table-column>
    </el-table>
    <!--列表工具条-->
    <el-col :span="24">
      <el-pagination class="f-mt10"
                     :current-page="currentPage"
                     :page-size="pageSize"
                     @size-change="handleSizeChange"
                     @current-change="handleCurrentChange"
                     layout="total,sizes,prev, pager, next, jumper"
                     :total="total" style="float: right">
      </el-pagination>
    </el-col>
    <!--TODO 必须 否页面加载不了  bug-->
    <div style="height: 50px"></div>
    <!-- 上部结束************-->

    <!--下部开始*************-->
    <el-tabs type="border-card" class="border-card">
      <!-- 任务情况/历史任务列表-->
      <el-tab-pane>
        <span slot="label">任务情况</span>
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="affirm" :disabled="topConditionsDisabled">接货确认</el-button>
          <el-button type="primary" @click="abnormityPage" :disabled="topConditionsDisabled">异常确认</el-button>
          <!--临时司机任务取消操作控制-->
          <!--<el-button v-if="isTemporaryDriver" type="primary" @click="temporaryDriverCancel" :disabled="topConditionsDisabled || !isTemporaryDriver">临时司机任务取消</el-button>-->
        </el-col>
        <el-table :data="taskInfoData" highlight-current-row border style="width: 100%;" max-height="300"
                  v-loading="taskInfoListLoading"
                  @sort-change="sortChangeInfo"
                  @selection-change="taskInfoSelsChange">
          <el-table-column type="selection" width="50" align="center">
          </el-table-column>
          <el-table-column prop="orderNumber" label="订单号" width="200" align="center" >
           <template slot-scope="scope">
             <a style="cursor: pointer;text-decoration:underline;color: #20a0ff"
                @click="orderSelectDialog(scope.row)">
               {{scope.row.orderNumber}}
             </a>
           </template>
          </el-table-column>
          <el-table-column prop="extractDate" label="预计提货日期&时间" width="250" align="center">
            <template slot-scope="scope">
              {{extractDateTime(scope.row.extractDate, scope.row.extractTime)}}
            </template>
          </el-table-column>
          <el-table-column prop="actualDateTime" label="实际提货日期&时间" width="250" align="center">
          </el-table-column>
          <el-table-column prop="amount" label="件数" width="150" align="center">
          </el-table-column>
          <el-table-column prop="weight" label="重量" width="150" align="center">
          </el-table-column>
          <el-table-column prop="volume" label="体积" width="150" align="center">
          </el-table-column>
          <el-table-column prop="remark" label="订单备注" min-width="300" align="left" header-align="center">
          </el-table-column>
        </el-table>
      </el-tab-pane>
      <el-tab-pane>
        <span slot="label">历史任务</span>
        <search-bar>
          <el-row :data="conditions">
            <el-col :span="8">
              <el-form-item label="订单号" >
                <el-input  v-model="conditionsHis.orderNumber"
                          placeholder="请输入订单号"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="实际提货日期"   >
                <el-date-picker
                  v-model="assignDateHis"
                  type="daterange"
                  align="right"
                  placeholder="选择日期范围"
                  :picker-options="pickerOptions2">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="提货区域" >
                <address-select
                  style="width: 100%"
                  @getAddresses="getAddresses"
                  v-model="conditionsHis.address"
                  placeholder="请选择提货区域"
                ></address-select>
              </el-form-item>
            </el-col>
          </el-row>
        </search-bar>
        <!-- 搜索end -->
        <!-- 操作 -->
        <el-col :span="24" style="margin-bottom: 10px">
          <el-button type="primary" @click="cancelAffirmHis">取消接货确认</el-button>
          <el-button type="primary" @click="resetConditionHistory" style="float: right">重置</el-button>
          <el-button type="primary" @click="searchTaskHistory" style="float: right;margin-right: 10px">查询</el-button>
          <el-button type="primary" @click="exportTaskHistory" style="float: right;margin-right: 10px">导出</el-button>
        </el-col>
        <!--操作end-->
        <!--列表-->
        <el-table :data="taskInfoDataHis" highlight-current-row border style="width: 100%;" max-height="300"
                  v-loading="hisListLoading"
                  @sort-change="sortChangeHis"
                  @selection-change="selsChangeHis">
          <el-table-column type="selection" width="50" align="center">
          </el-table-column>
          <el-table-column prop="orderNumber" label="订单号" width="150" align="center" >
            <template slot-scope="scope">
              <a style="cursor: pointer;text-decoration:underline;color: #20a0ff"
                 @click="orderSelectDialog(scope.row)">
                {{scope.row.orderNumber}}
              </a>
            </template>
          </el-table-column>
          <el-table-column label="提货区域" width="150px" align="center">
            <template slot-scope="scope">
              {{scope.row.shipmentsCity}}{{scope.row.shipmentsCounty}}
            </template>
          </el-table-column>
          <el-table-column prop="extractDate" label="预计提货日期&时间" width="200" align="center" >
            <template slot-scope="scope">
              {{extractDateTime(scope.row.extractDate, scope.row.extractTime)}}
            </template>
          </el-table-column>
          <el-table-column prop="actualDate" label="实际提货日期&时间" width="200" align="center" >
          </el-table-column>
          <el-table-column prop="amount" label="件数" width="80" align="center" >
          </el-table-column>
          <el-table-column prop="actualAmount" label="接货件数" width="100" align="center">
          </el-table-column>
          <el-table-column prop="weight" label="重量" width="100" align="center" >
          </el-table-column>
          <el-table-column prop="actualWeight" label="接货重量" width="70" align="center">
          </el-table-column>
          <el-table-column prop="volume" label="体积" width="100" align="center" >
          </el-table-column>
          <el-table-column prop="actualVolume" label="接货体积" width="70" align="center">
          </el-table-column>
          <el-table-column prop="receiverName" label="交接人" width="100" align="center" >
          </el-table-column>
          <el-table-column prop="receiveTime" label="交接时间" width="200" align="center" >
          </el-table-column>
          <el-table-column prop="taskExceptionType" label="异常类型" width="70" align="center"
                           :formatter="exceptionTypeFormatter">
          </el-table-column>
          <el-table-column prop="orderRemark" label="订单备注" width="100" align="center">
          </el-table-column>
        </el-table>

        <!--列表工具条-->
        <el-col :span="24">
          <el-pagination class="f-mt10"
                         :current-page="currentPageHis"
                         :page-size="pageSizeHis"
                         @size-change="handleSizeChangeHis"
                         @current-change="handleCurrentChangeHis"
                         layout="total,sizes,prev, pager, next, jumper"
                         :total="totalHis" style="float: right">
          </el-pagination>
        </el-col>
      </el-tab-pane>
    </el-tabs>
    <!--下部结束*************-->

    <!--异常确认弹出窗口********-->
    <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" size="tiny">
      <el-form :key="dialogKey" :model="shortTaskTraceDetail" ref="dialogForm" :rules="dialogRules" label-width="120px" >
        <el-form-item label="异常类型" prop="taskExceptionType">
          <el-select v-model="shortTaskTraceDetail.taskExceptionType" class="dialog-form-content" placeholder="请选择异常类型">
            <el-option
              v-for="item in $store.getters.PICKUP_LOADING_EXCEPTION_TYPE"
              :key="item.dictVal"
              :label="item.cnDictValname"
              :value="item.dictVal">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="交接件数" prop="actualAmount">
          <el-input v-model.number="shortTaskTraceDetail.actualAmount" class="dialog-form-content" type="integer"
                    auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="交接重量" prop="actualWeight">
          <el-input v-model.number="shortTaskTraceDetail.actualWeight" class="dialog-form-content" auto-complete="off"
                    type="number" step="0.01"></el-input>
        </el-form-item>
        <el-form-item label="交接体积" prop="actualVolume">
          <el-input v-model.number="shortTaskTraceDetail.actualVolume" class="dialog-form-content" type="number" step="0.01"
                    auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="交接人" prop="receiverName" >
          <el-input v-model="shortTaskTraceDetail.receiverName" class="dialog-form-content" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="交接日期" prop="receiveTime">
          <el-date-picker
                          style="width: 350px"
                          v-model="shortTaskTraceDetail.receiveTime"
                          type="datetime"
                          placeholder="选择日期时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input type="textarea" v-model="shortTaskTraceDetail.remark" :rows="4" placeholder="请输入内容"
                    class="dialog-form-content"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="resetDialogForm(true)">取 消</el-button>
        <el-button type="primary" @click.native="submitAbnormity()" :loading="submitLoading">提交</el-button>
      </div>
    </el-dialog>
    <!--订单查看Dialog-->
    <el-dialog title="订单查看" :visible.sync="orderSelect" width="80%">
      <order-select :title="orderSelectForm"></order-select>
    </el-dialog>
  </section>
</template>
<script>
import {
  searchDriverInfos, getOrderTableData, shortTasksForTrace,
  affirmCargo, saveShortTaskTraceEnormity, searchShortTaskTraceHs,
  cancelAffirmCargo,
  cancelTemporaryDriverTask
} from '../../api/stowage/shortTask';
import { getOrder } from '../../api/order/order.js';
import { isEmpty } from '../../lib/util';
import OrderSelect from '../order/OrderSelectDialog.vue';
export default {
  components: {
    'order-select': OrderSelect
  },
  data () {
    return {
      //* *************通用属性***************
      token: this.$store.state.token,
      // 订单详情页查看
      orderSelectForm: {},
      orderSelect: false,
      searchConditionLabelWidth: '100px',
      listLoading: false,
      vehicleIdLoading: false,
      driverIdLoading: false,
      driverTelPhoneLoading: false,
      // 日期控件
      pickerOptions2: {
        shortcuts: [{
          text: '最近一周',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick (picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },

      //* ***************上部短驳车辆查询--（订单号输入框，提货时间下来框，发货时间下来框 可操作与否控制----查询没有未完成任务的车辆时是不需要这些过滤条件的）
      topConditionsDisabled: false, // 默认可操作

      // 上部列表点击缓存数据
      isTemporaryDriver: false, // 是否临时司机
      topRowId: null, // 默认第一行
      clickVehicleId: '', // 上部行点击事件，保存车辆id信息-上部行点击事件或刷新时得清除
      clickDriverId: '', // 上部行点击事件，司机id信息-上部行点击事件或刷新时得清除
      clickOrderIds: '', // 用于保存点击上部记录时传递的orderIds，用于排序时传递的参数,上部行点击事件或刷新时得清除
      clickOrderNumbers: '', // 暂未用到
      clickDriverName: '', // 司机名字--临时司机任务查询用
      clickDriverPhone: '', // 司机电话--临时司机任务查询用
      clickPlateNumber: '', // 车牌--临时司机任务查询用

      //* ************上部接货任务查询*****************************
      // 远程加载下拉框数据
      vehicleIdOptions: [], // 车牌号-车辆id
      driverIdOptions: [], // 司机名-司机id
      driverTelPhoneOptions: [], // 司机名-司机电话
      conditions: {
        isTemporary: false,
        plateNumber: '', // 车牌号 （车牌号-id） --多选
        driverName: '', // 司机(下拉框  名-id）--多选
        orderNumber: '', // 订单号  非订单id（数据库两个都有保存）
        isInExecution: true, // 根据是否沟选判断真假
        driverPhone: '', // 司机手机号，--多选
        shipmentsDateBegin: null, // 发运日期开始
        shipmentsDateEnd: null, // 发运日期结束
        assignDateBegin: null, // 提货时间区间开始
        assignDateEnd: null, // 提货时间区间结束
        isSelfDriver: true, // 是否是自有司机
        isSelfVehicle: false // 是否是自有车辆
      },
      // 接货车辆查询列表
      shortTaskData: [],
      sels: [], // 接货任务查询列表选择框
      total: 0,
      currentPage: 1,
      pageSize: 30,
      sortProp: '',
      sortOrder: 'ascending',

      // 下拉框选择保存数据
      shipmentsDate: '', // 发运日期区间
      assignDate: '', // 提货时间区间
      driverInfoIds: [], // 司机下拉框
      vehicleIds: [], // 车辆下拉框
      driverPhones: [], // 司机电话下拉框

      //* ********任务情况标签页*****************(根据接货车辆查询得到的订单ID(可能多个）获取任务列表）

      taskInfoListLoading: false,
      taskInfoSels: [], // 任务情况选择框

      //* ************异常确认窗口**
      dialogFormLabelWidth: '180px',
      submitLoading: false,
      dialogFormVisible: false,
      dialogKey: null,
      dialogTitle: '异常确认',
      // 表单验证
      dialogRules: {
        taskExceptionType: [
          {required: true, type: 'number', message: '请选择异常类型', trigger: 'change'}
        ],
        actualAmount: [
          {required: true, message: '请输入实际货品件数'},
          {type: 'integer', message: '请输入正整数'}
        ],
        actualWeight: [
          {required: true, message: '请输入实际货品重量'},
          {type: 'number', min: 0, max: 10000, message: '货品重量在0-10000吨以内'}
        ],
        actualVolume: [
          {required: true, message: '请输入实际货品体积'},
          {type: 'number', min: 0, max: 10000, message: '货品体积在0-10000方以内'}
        ],
        receiverName: [
          {required: true, message: '请输入交接人姓名'},
          {max: 15, message: '长度在 15字符内'}
        ],
        receiveTime: [
          {type: 'date', required: true, message: '请输入交接日期', trigger: 'blur'}
        ]
      },
      taskInfoData: [],
      // 表单数据
      shortTaskTrace: {
        'id': '',
        'shortTaskId': '',
        'orderId': '',
        'orderNumber': '',
        'taskExceptionType': null,
        'isCompleted': false,
        'taskExeDescription': '交接确认中的异常确认',
        'location': '',
        'remark': '接货异常确认'
      },
      shortTaskTraceDetail: {
        'id': '',
        'shortTaskId': '',
        'orderId': '',
        'orderNumber': '',
        'shortTaskTraceId': '',
        'orderCargoId': '',
        'actualAmount': null,
        'actualWeight': null,
        'actualVolume': null,
        'taskExceptionType': null,
        'receiver': null,
        'receiverName': null,
        'receiveTime': null,
        'remark': ''
      },
      sortPropInfo: '',
      sortOrderInfo: 'ascending',

      //* **********历史任务标签页************************(根据接货车辆查询得到的司机ID(可能多个）获取任务列表）
      hisListLoading: false,
      addresses: [],
      abnormitySels: [], // 取消接货确认选择框
      conditionsHis: {
        orderNumber: '', // 订单号  非订单id（数据库两个都有保存）
        assignDateBegin: null, // 提货时间区间开始
        assignDateEnd: null, // 提货时间区间结束
        address: null
      },
      totalHis: 0,
      currentPageHis: 1,
      pageSizeHis: 30,
      sortPropHis: '',
      sortOrderHis: 'ascending',
      taskInfoDataHis: [],
      assignDateHis: '', // 提货时间区间(历史记录标签页）
      selsHis: [] // 历史列表选择框

    };
  },
  watch: {
    'conditions.isInExecution': {
      handler (val) {
        this.topConditionsDisabled = !val;
      },
      deep: 1
    }
  },
  methods: {
    // 是否临时车辆
    isTemporary (row, column) {
      if (isEmpty(row.driverInfoId) || isEmpty(row.vehicleId)) {
        return '是';
      } else {
        return '否';
      }
    },
    // 统计数转为小数点后两位
    numberFormatter (value) {
      if (value > 0) {
        return value.toFixed(2);
      }
    },
    // 历史记录异常类型字典值转换成字典名
    exceptionTypeFormatter (row, column) {
      if (isEmpty(row.taskExceptionType)) {
        return '';
      }
      let items = this.$store.getters.PICKUP_LOADING_EXCEPTION_TYPE;
      for (let p in items) {
        if (items[p].dictVal === row.taskExceptionType) {
          return items[p].cnDictValname;
        }
      }
      return '';
    },
    //* ***********************************************接货车辆查询*******************
    // 加载司机下拉列表数据
    driverIdRemoteMethod (value) {
      if (value !== '') {
        setTimeout(() => {
          this.driverIdLoading = true;
          let params = 'name?' + value;
          searchDriverInfos({
            token: this.token,
            page: 1,
            size: 100,
            filters: params,
            sorts: '+name'
          }).then((res) => {
            this.driverIdLoading = false;
            if (res.data.successFlg === true) {
              if (res.data.detailModelList != null && res.data.detailModelList.length > 0) {
                this.driverIdOptions = res.data.detailModelList;
              }
            } else {
              this.driverIdOptions = [];
            }
          }).catch(() => {
            this.$message.error('数据有误，查询失败！');
            this.driverIdLoading = false;
          });
        }, 500);
      } else {
        this.driverIdOptions = [];
      }
    },
    // 加载司机电话下拉列表数据
    driverTelPhoneMethod (value) {
      if (value !== '') {
        setTimeout(() => {
          this.driverTelPhoneLoading = true;
          let params = 'phone?' + value;
          searchDriverInfos({
            token: this.token,
            page: 1,
            size: 100,
            filters: params,
            sorts: '+plateNumber'
          }).then((res) => {
            this.driverTelPhoneLoading = false;
            if (res.data.successFlg === true) {
              if (res.data.detailModelList != null && res.data.detailModelList.length > 0) {
                this.driverTelPhoneOptions = res.data.detailModelList;
              }
            } else {
              this.driverTelPhoneOptions = [];
            }
          }).catch(() => {
            this.$message.error('数据有误，查询失败！');
            this.driverTelPhoneLoading = false;
          });
        }, 500);
      } else {
        this.driverTelPhoneOptions = [];
      }
    },
    // 接货任务查询
    searchShortTask () {
      // 清空数据操作
      // 查询之前清空下拉框，
      this.resetSelections();
      // 查询之前清除旧日期数据
      this.resetDateTime();
      // 查询之前清空任务详情，历史任务列表
      this.taskInfoData = [];
      this.taskInfoDataHis = [];
      // 清除用于下部页面列表查询的缓存数据
      this.resetClickData();
      if (!isEmpty(this.shipmentsDate) && !isEmpty(this.shipmentsDate[0])) {
        this.conditions.shipmentsDateBegin = this.shipmentsDate[0].toJSON();
        this.conditions.shipmentsDateEnd = this.shipmentsDate[1].toJSON();
      }
      if (!isEmpty(this.assignDate) && !isEmpty(this.assignDate[0])) {
        this.conditions.assignDateBegin = this.assignDate[0].toJSON();
        this.conditions.assignDateEnd = this.assignDate[1].toJSON();
      }
      this.listLoading = true;
      this.conditions.page = this.currentPage;
      this.conditions.size = this.pageSize;
      this.conditions.sorts = (isEmpty(this.sortProp) ? '' : (this.sortOrder === 'ascending' ? '-' : '+') + this.sortProp);
      shortTasksForTrace(this.conditions).then((res) => {
        this.listLoading = false;
        if (res.data.successFlg === true && res.data.detailModelList !== null) {
          if (res.data.detailModelList.length > 0) {
            // 结果不为空 ，添加行号rowId (从0开始）
            let dataList = res.data.detailModelList;
            for (let i in dataList) {
              dataList[i].rowId = i;
            }
            this.shortTaskData = dataList;
          } else {
            this.shortTaskData = [];
          }
          this.currentPage = res.data.currPage;
          this.total = res.data.totalCount;
          this.pageSize = res.data.pageSize;
        } else {
          this.shortTaskData = [];
        }
      }).catch(() => {
        this.$message.error('数据有误，查询失败！');
        this.listLoading = false;
      });
    },
    // 查询按钮
    handleSearch () {
      this.resetClickData();// 清除用于下部列表查询的数据（车辆id，订单ids)
      this.searchShortTask();
    },
    // 排序改变
    sortChange (o) {
      this.sortProp = o.prop;
      this.sortOrder = o.order;
      this.searchShortTask();
    },

    // 清除用于下部页面列表查询的缓存数据
    resetClickData () {
      this.topRowId = '';
      this.clickOrderIds = '';
      this.clickVehicleId = '';
      this.clickDriverId = '';
      this.clickOrderNumbers = '';
      this.clickPlateNumber = '';//  车牌--临时司机任务查询用
      this.clickDriverName = ''; // 司机名字--临时司机任务查询用
      this.clickDriverPhone = ''; // 司机电话--临时司机任务查询用
    },
    // ----------------点击行事件（加载任务详情列表和历史任务列表）
    rowClick (row) {
      // 记录当前点击的行号，用于数据更新
      this.topRowId = row.rowId;
      this.topTaskExeStatus = row.taskExeStatus; // 用于下部历史记录取消操作时判断查询类别（有/无未完成任务车辆）
      // 记录当前车辆id号，用于列表数据查询过滤条件之一
      this.clickVehicleId = row.vehicleId;
      this.clickDriverId = row.driverInfoId;
      if (isEmpty(row.driverInfoId)) {
        this.isTemporaryDriver = true;
      } else {
        this.isTemporaryDriver = false;
      }
      this.clickOrderIds = row.orderIds;
      this.clickOrderNumbers = row.orderNumbers;
      this.clickPlateNumber = row.plateNumber;
      this.clickDriverName = row.driverName;
      this.clickDriverPhone = row.driverPhone;
      // 清空下部历史任务查询条件
      this.resetConditionHistory();
      // 加载任务情况列表
      this.searchTaskInfoList();
      //                //根据车辆id 查询历史任务列表（短驳任务执行状态为 101013004）
      this.searchTaskHistory();
    },
    // 多选框
    selsChange (sels) {
      this.sels = sels;
    },
    // 每页几条操作
    handleSizeChange (val) {
      this.pageSize = val;
      this.searchShortTask();
    },
    // 第几页操作
    handleCurrentChange (val) {
      this.currentPage = val;
      this.searchShortTask();
    },
    // 重置查询条件
    resetCondition () {
      this.conditions = {
        isChecked: 1, // 当勾选时，查询有未完成接货任务的车辆，当非勾选时，查询的是没有未完成接货任务的车辆。
        vehicleIds: '', // 车牌号 （车牌号-id） --多选
        driverInfoIds: '', // 司机(下拉框  名-id）--多选
        orderNumber: '', // 订单号  非订单id（数据库两个都有保存）
        isInExecution: true, // 根据是否沟选判断真假
        driverPhones: '', // 司机手机号，--多选
        shipmentsDateBegin: null, // 发运日期开始
        shipmentsDateEnd: null, // 发运日期结束
        assignDateBegin: null, // 提货时间区间开始
        assignDateEnd: null, // 提货时间区间结束
        isTemporary: false, // 是否临时车辆/司机
        isSelfDriver: true, // 自有司机
        isSelfVehicle: false // 自有车辆
      };
      this.shipmentsDate = ''; // 发运日期区间
      this.assignDate = ''; // 提货时间区间
      this.driverInfoIds = [];// 司机下拉框
      this.vehicleIds = []; // 车辆下拉框
      this.driverPhones = []; // 司机电话下拉框
    },
    // 查询按钮点击之前清空下拉框、日期框数据（残留数据影响）
    resetSelections () {
      this.conditions.shipmentsDateBegin = '';
      this.conditions.shipmentsDateEnd = '';
      this.conditions.assignDateBegin = '';
      this.conditions.assignDateEnd = '';
    },
    // 查询按钮点击之前清空历史日期选择数据
    resetDateTime () {
      this.conditions.vehicleIds = '';
      this.conditions.driverInfoIds = '';
      this.conditions.driverPhones = '';
    },
    // 整车确认
    affirmAll () {
      let shortTaskIds = this.sels.map(item => item.shortTaskId);
      if (shortTaskIds === '' || shortTaskIds == null) {
        this.$message.error('请选择数据！');
        return;
      }
      this.$confirm('确认进行整车入库操作？', '提示', {
        type: 'warning'
      }).then(() => {
        affirmCargo({
          token: this.token,
          shortTaskIds: shortTaskIds.join(',')
        }).then((res) => {
          this.sendListLoading = false;
          if (res.data.successFlg === true) {
            this.$message.success('确认成功！');
            // 刷新上部列表
            this.searchShortTask();
            // 清空下部列表
            this.taskInfoData = [];
            this.taskInfoDataHis = [];
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch(() => {
          this.$message.error('数据有误，操作失败！');
          this.sendListLoading = false;
        });
      });
    },
    //* *********************************************任务情况标签页*******************
    // 加载任务情况(根上部查询获得的orderId/orderNumber
    sortChangeInfo (o) {
      this.sortPropInfo = o.prop;
      this.sortOrderInfo = o.order;
      this.searchTaskInfoList();// 当排序操作时取得参数
    },
    searchTaskInfoList () {
      this.taskInfoListLoading = true;
      // 后台根据车辆id查询符合条件的orderNumbers，在进行订单表的查询
      getOrderTableData({
        vehicleId: this.clickVehicleId,
        driverId: this.clickDriverId,
        plateNumber: this.clickPlateNumber,
        driverName: this.clickDriverName,
        driverPhone: this.clickDriverPhone,
        token: this.token,
        filters: '',
        sorts: isEmpty(this.sortPropInfo) ? '' : (this.sortOrderInfo === 'ascending' ? '-' : '+') + this.sortPropInfo,
        size: 100,
        page: 1
      }).then((res) => {
        this.taskInfoListLoading = false;
        if (res.data.successFlg === true) {
          if (res.data.detailModelList.length > 0) {
            // 结果不为空 ，添加行号rowId (从0开始）
            let taskInfoDataList = res.data.detailModelList;
            for (let i in taskInfoDataList) {
              taskInfoDataList[i].rowId = i;
            }
            this.taskInfoData = taskInfoDataList;
            console.log(JSON.stringify(taskInfoDataList));
          } else {
            this.taskInfoData = [];
          }
        } else {
          this.taskInfoData = [];
        }
      }).catch(() => {
        this.taskInfoListLoading = false;
        this.$message.error('参数有误，查询失败！');
      });
    },
    // 任务情况多选框
    taskInfoSelsChange (taskInfoSels) {
      this.taskInfoSels = taskInfoSels;
    },
    // 预计提货日期时间处理
    extractDateTime (date, time) {
      if (isEmpty(date)) {
        return '';
      }
      if (time) {
        return date.substring(0, 10) + '  ' + time;
      }
      return date.substring(0, 10);
    },
    // 接货确认
    affirm () {
      let shortTaskIds = this.taskInfoSels.map(item => item.shortTaskId);
      let rowIds = this.taskInfoSels.map(item => item.rowId);
      if (shortTaskIds === '' || shortTaskIds == null) {
        this.$message.error('请选择数据！');
        return;
      }
      let isAll = false;
      if (shortTaskIds.length === this.taskInfoData.length) {
        isAll = true;
      }
      this.$confirm('确认进行接货入库操作', '提示', {
        type: 'warning'
      }).then(() => {
        affirmCargo({
          token: this.token,
          shortTaskIds: shortTaskIds.join(',')
        }).then((res) => {
          this.sendListLoading = false;
          if (res.data.successFlg === true) {
            this.$message.success('确认成功！');
            if (isAll) {
              // 当下部为全选确认收货时刷新上部列表（为了保证分页数据的准确性，从新加载数据）
              this.searchShortTask();
              // 清空下部列表
              this.taskInfoData = [];
              this.taskInfoDataHis = [];
            } else {
              // 修改上部当前行数据（当下部只是部分接货确认时）
              // 接货确认票数，件数，重量，体积
              let totalAmount = 0;
              let totalWeight = 0.00;
              let totalVolume = 0.00;
              for (var i = 0; i < rowIds.length; i++) {
                totalAmount = totalAmount + this.taskInfoData[rowIds[i]].amount;
                totalWeight = totalWeight + this.taskInfoData[rowIds[i]].weight;
                totalVolume = totalVolume + this.taskInfoData[rowIds[i]].volume;
              }
              this.shortTaskData[this.topRowId].totalVotes = this.shortTaskData[this.topRowId].totalVotes - rowIds.length;
              this.shortTaskData[this.topRowId].totalAmount = this.shortTaskData[this.topRowId].totalAmount - totalAmount;
              this.shortTaskData[this.topRowId].totalWeight = this.shortTaskData[this.topRowId].totalWeight - totalWeight;
              this.shortTaskData[this.topRowId].totalVolume = this.shortTaskData[this.topRowId].totalVolume - totalVolume;

              // 刷新下部列表
              this.searchTaskInfoList();
              this.searchTaskHistory();
            }
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch(() => {
          this.$message.error('数据有误，操作失败！');
          this.sendListLoading = false;
        });
      });
    },
    // 临时司机任务取消
    temporaryDriverCancel () {
      let shortTaskIds = this.taskInfoSels.map(item => item.shortTaskId);
      let rowIds = this.taskInfoSels.map(item => item.rowId);
      if (shortTaskIds === '' || shortTaskIds == null) {
        this.$message.error('请选择数据！');
        return;
      }
      let isAll = false;
      if (shortTaskIds.length === this.taskInfoData.length) {
        isAll = true;
      }
      this.$confirm('确认取消该临时司机任务？', '提示', {
        type: 'warning'
      }).then(() => {
        cancelTemporaryDriverTask({
          token: this.token,
          shortTaskIds: shortTaskIds.join(',')
        }).then((res) => {
          this.sendListLoading = false;
          if (res.data.successFlg === true) {
            this.$message.success('取消成功！');
            if (isAll) {
              // 当下部为全选确认收货时刷新上部列表（为了保证分页数据的准确性，从新加载数据）
              this.searchShortTask();
              // 清空下部列表
              this.taskInfoData = [];
              this.taskInfoDataHis = [];
            } else {
              // 修改上部当前行数据（当下部只是部分接货确认时）
              // 接货确认票数，件数，重量，体积
              let totalAmount = 0;
              let totalWeight = 0.00;
              let totalVolume = 0.00;
              for (var i = 0; i < rowIds.length; i++) {
                totalAmount = totalAmount + this.taskInfoData[rowIds[i]].amount;
                totalWeight = totalWeight + this.taskInfoData[rowIds[i]].weight;
                totalVolume = totalVolume + this.taskInfoData[rowIds[i]].volume;
              }
              this.shortTaskData[this.topRowId].totalVotes = this.shortTaskData[this.topRowId].totalVotes - rowIds.length;
              this.shortTaskData[this.topRowId].totalAmount = this.shortTaskData[this.topRowId].totalAmount - totalAmount;
              this.shortTaskData[this.topRowId].totalWeight = this.shortTaskData[this.topRowId].totalWeight - totalWeight;
              this.shortTaskData[this.topRowId].totalVolume = this.shortTaskData[this.topRowId].totalVolume - totalVolume;
              // 刷新下部列表
              this.searchTaskInfoList();
            }
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch(() => {
          this.$message.error('数据有误，操作失败！');
          this.sendListLoading = false;
        });
      });
    },
    //* **********接货异常弹出窗口*****************
    // 清空表单
    resetDialogForm (close) {
      this.shortTaskTrace = {
        'id': '',
        'shortTaskId': '',
        'orderId': '',
        'orderNumber': '',
        'taskExceptionType': null,
        'taskExeStatus': 101013004,
        'taskExeDescription': '交接确认中的异常确认',
        'location': '',
        'remark': '接货异常确认',
        'shortTaskTraceDetail': {}
      };
      this.shortTaskTraceDetail = {
        'id': '',
        'shortTaskId': '',
        'orderId': '',
        'orderNumber': '',
        'shortTaskTraceId': '',
        'orderCargoId': '',
        'actualAmount': null,
        'actualWeight': null,
        'actualVolume': null,
        'taskExceptionType': null,
        'receiver': null,
        'receiveTime': null,
        'remark': '',
        // 用于确认成功后的计算
        'amount': null, // 异常确认行数量
        'weight': null, // 异常确认行重量
        'volume': null// 异常确认行体积
      };
      if (close) {
        this.dialogFormVisible = false;
      }
    },
    // 打开异常记录窗口
    abnormityPage () {
      this.resetDialogForm(false);
      let selsObj = this.taskInfoSels.map(item => item);
      if (selsObj.length > 1) {
        this.$message.error('请选择单条数据！');
        return;
      }
      if (selsObj.length === 0) {
        this.$message.error('请选择一条数据！');
        return;
      }
      this.shortTaskTrace.shortTaskId = selsObj[0].shortTaskId;
      this.shortTaskTrace.orderId = selsObj[0].orderId;
      this.shortTaskTraceDetail.orderId = selsObj[0].orderId;
      this.shortTaskTrace.orderNumber = selsObj[0].orderNumber;
      this.shortTaskTraceDetail.orderNumber = selsObj[0].orderNumber;
      this.shortTaskTraceDetail.orderCargoId = selsObj[0].orderCargoId;
      this.shortTaskTraceDetail.amount = selsObj[0].amount;
      this.shortTaskTraceDetail.weight = selsObj[0].weight;
      this.shortTaskTraceDetail.volume = selsObj[0].volume;
      this.dialogFormVisible = true;
      this.dialogKey = Math.random() - 0.5;
      // 提交异常信息
    },
    // 提交异常
    submitAbnormity () {
      this.$refs['dialogForm'].validate((valid) => {
        // 判断是否全部---刷新页面/还是页面加减
        let isAll = false;
        if (this.taskInfoData.length === 1) {
          isAll = true;
        }
        if (valid) {
          this.submitLoading = true;
          this.shortTaskTrace.taskExceptionType = this.shortTaskTraceDetail.taskExceptionType;
          this.shortTaskTrace.shortTaskTraceDetail = this.shortTaskTraceDetail;
          saveShortTaskTraceEnormity(this.token, this.shortTaskTrace).then((res) => {
            this.submitLoading = false;
            this.dialogFormVisible = false;
            if (res.data.successFlg === true) {
              this.$message.success('接货异常确认成功！');
              if (isAll) {
                // 当下部为全选确认收货/或最后一天记录的异常确认时刷新上部列表（为了保证分页数据的准确性，从新加载数据）
                this.searchShortTask();
                // 清空下部列表
                this.taskInfoData = [];
                this.taskInfoDataHis = [];
              } else {
                // 修改上部当前行数据（当下部只是部分接货确认/异常确认时）
                // 接货确认票数，件数，重量，体积
                let amount = this.shortTaskTraceDetail.amount;
                let weight = this.shortTaskTraceDetail.weight;
                let volume = this.shortTaskTraceDetail.volume;
                this.shortTaskData[this.topRowId].totalVotes = this.shortTaskData[this.topRowId].totalVotes - 1;
                this.shortTaskData[this.topRowId].totalAmount = this.shortTaskData[this.topRowId].totalAmount - amount;
                this.shortTaskData[this.topRowId].totalWeight = this.shortTaskData[this.topRowId].totalWeight - weight;
                this.shortTaskData[this.topRowId].totalVolume = this.shortTaskData[this.topRowId].totalVolume - volume;
                // 刷新下部列表
                this.searchTaskInfoList();
                this.searchTaskHistory();
              }
            } else {
              this.$message.error(res.data.errorMsg);
            }
          }).catch(function (error) {
            console.log(error);
          });
        } else {
          return false;
        }
      });
    },

    //* ****************************************************历史任务标签页***************************
    getAddresses (data) {
      this.addresses = data;
    },
    // 重置查询条件
    resetConditionHistory () {
      this.conditionsHis = {
        orderNumber: '', // 订单号  非订单id（数据库两个都有保存）
        assignDateBegin: null, // 提货时间区间开始
        assignDateEnd: null// 提货时间区间结束
      };
      this.assignDateHis = [];
    },
    // 查询历史任务
    searchTaskHistory () {
      if (isEmpty(this.clickDriverId)) {
        if (isEmpty(this.clickPlateNumber) || isEmpty(this.clickDriverName) || isEmpty(this.clickDriverPhone)) {
          this.$message.error('司机id或（车牌+司机姓名+司机电话）不能为空！');
          return;
        }
      }
      if (!isEmpty(this.assignDateHis) && !isEmpty(this.assignDateHis[0])) {
        this.conditionsHis.assignDateBegin = this.assignDateHis[0].Format('yyyy-MM-dd') + ' 00:00:00';
        this.conditionsHis.assignDateEnd = this.assignDateHis[1].Format('yyyy-MM-dd') + ' 23:59:59';
      }
      if (!isEmpty(this.conditionsHis.orderNumber)) {
        this.conditionsHis.orderNumber = this.conditionsHis.orderNumber;
      }
      this.hisListLoading = true;
      let hereAddress = '';
      for (let p in this.conditionsHis.address) {
        if (p < 3) {
          hereAddress += this.conditionsHis.address[p] + ',';
        }
      }
      searchShortTaskTraceHs({
        token: this.token,
        page: this.currentPageHis,
        size: this.pageSizeHis,
        vehicleId: this.clickVehicleId,
        driverId: this.clickDriverId,
        plateNumber: this.clickPlateNumber,
        driverName: this.clickDriverName,
        driverPhone: this.clickDriverPhone,
        orderNumber: this.conditionsHis.orderNumber,
        assignDateBegin: this.conditionsHis.assignDateBegin,
        assignDateEnd: this.conditionsHis.assignDateEnd,
        extractAddress: hereAddress,
        sorts: (isEmpty(this.sortPropHis) ? '' : (this.sortOrderHis === 'ascending' ? '-' : '+') + this.sortPropHis)
      }).then((res) => {
        this.hisListLoading = false;
        if (res.data.successFlg === true) {
          this.taskInfoDataHis = [];
          if (res.data.detailModelList.length > 0) {
            // 结果不为空 ，添加行号rowId (从0开始）
            let taskInfoDataHisList = res.data.detailModelList;
            for (let i in taskInfoDataHisList) {
              taskInfoDataHisList[i].rowId = i;
            }
            this.taskInfoDataHis = taskInfoDataHisList;
          } else {
            this.taskInfoDataHis = [];
          }
          this.currentPageHis = res.data.currPage;
          this.totalHis = res.data.totalCount;
          this.pageSizeHis = res.data.pageSize;
        } else {
          this.taskInfoDataHis = [];
        }
      }).catch(() => {
        this.hisListLoading = false;
      });
    },
    exportTaskHistory () {
      if (isEmpty(this.clickDriverId)) {
        if (isEmpty(this.clickPlateNumber) || isEmpty(this.clickDriverName) || isEmpty(this.clickDriverPhone)) {
          this.$message.error('司机id或（车牌+司机姓名+司机电话）不能为空！');
          return;
        }
      }
      if (!isEmpty(this.assignDateHis) && !isEmpty(this.assignDateHis[0])) {
        this.conditionsHis.assignDateBegin = this.assignDateHis[0].Format('yyyy-MM-dd') + ' 00:00:00';
        this.conditionsHis.assignDateEnd = this.assignDateHis[1].Format('yyyy-MM-dd') + ' 23:59:59';
      }
      if (!isEmpty(this.conditionsHis.orderNumber)) {
        this.conditionsHis.orderNumber = this.conditionsHis.orderNumber;
      }
      this.hisListLoading = true;
      let hereAddress = '';
      for (let p in this.conditionsHis.address) {
        if (p < 3) {
          hereAddress += this.conditionsHis.address[p] + ',';
        }
      }
      location.href = '/api/v2.0/admin/export_short_tasks_trace/detail_hs?token=' + this.token + '&page=' + this.currentPageHis + '&size=' + this.pageSizeHis +
          '&vehicleId=' + this.clickVehicleId + '&driverId=' + this.clickDriverId + '&plateNumber=' + this.clickPlateNumber + '&driverName=' + this.clickDriverName +
          '&driverPhone=' + this.clickDriverPhone + '&orderNumber=' + this.conditionsHis.orderNumber + '&assignDateBegin=' + this.conditionsHis.assignDateBegin +
          '&assignDateEnd=' + this.conditionsHis.assignDateEnd + '&extractAddress=' + hereAddress + '&sorts=' + (isEmpty(this.sortPropHis) ? '' : (this.sortOrderHis === 'ascending' ? '-' : '+') + this.sortPropHis);
      this.searchTaskHistory();
    },
    // 取消接货确认
    cancelAffirmHis () {
      let rowId = this.selsHis.map(item => item.rowId);
      let shortTaskIds = this.selsHis.map(item => item.shortTaskId);
      if (shortTaskIds == null || shortTaskIds.length < 1) {
        this.$message.error('请选择一条数据！');
        return;
      }
      if (shortTaskIds.length > 1) {
        this.$message.error('请选择单条数据！');
        return;
      }
      this.$confirm('确认取消接货确认？', '提示', {
        type: 'warning'
      }).then(() => {
        this.hisListLoading = true;
        cancelAffirmCargo({
          token: this.token,
          shortTaskIds: shortTaskIds.join(',')
        }).then((res) => {
          this.hisListLoading = false;
          if (res.data.successFlg === true) {
            this.$message.success('取消接货确认成功！');
            // 判断上部任务执行状态，刷新/修改部列表数据
            if (this.topTaskExeStatus !== 101013005) {
              let totalAmount = this.taskInfoDataHis[rowId].amount;
              let totalWeight = this.taskInfoDataHis[rowId].weight;
              let totalVolume = this.taskInfoDataHis[rowId].volume;
              this.shortTaskData[this.topRowId].totalVotes = this.shortTaskData[this.topRowId].totalVotes - (-1);
              this.shortTaskData[this.topRowId].totalAmount = this.shortTaskData[this.topRowId].totalAmount + totalAmount;
              this.shortTaskData[this.topRowId].totalWeight = this.shortTaskData[this.topRowId].totalWeight + totalWeight;
              this.shortTaskData[this.topRowId].totalVolume = this.shortTaskData[this.topRowId].totalVolume + totalVolume;
              // 刷新任务情况列表
              this.searchTaskInfoList();
              // 刷新历史任务列表
              this.searchTaskHistory();
            } else {
              // 刷新上部列表
              this.searchShortTask();
              // 清空下部列表
              this.taskInfoData = [];
              this.taskInfoDataHis = [];
            }
          } else {
            this.$message.error(res.data.errorMsg);
          }
        }).catch(() => {
          this.hisListLoading = false;
        });
      });
    },
    /**
       * 查看订单
       */
    orderSelectDialog (val) {
      this.orderSelect = true;
      getOrder(this.token, val.orderId).then((res) => {
        if (res.data.successFlg) {
          this.orderSelectForm = res.data.obj;
        }
      });
    },
    // 排序改变
    sortChangeHis (o) {
      this.sortPropHis = o.prop;
      this.sortOrderHis = o.order;
      this.searchTaskHistory();
    },
    // 多选框
    selsChangeHis (sels) {
      this.selsHis = sels;
    },
    // 每页几条操作
    handleSizeChangeHis (val) {
      this.pageSizeHis = val;
      this.searchTaskHistory();
    },
    // 第几页操作
    handleCurrentChangeHis (val) {
      this.currentPageHis = val;
      this.searchTaskHistory();
    }
  },
  mounted () {
    this.$store.commit('initDict');
    this.searchShortTask();
  }
};
</script>
